﻿using Microsoft.EntityFrameworkCore;
using QModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace QServices;

public partial class SqliteDbContext : DbContext
{

	public static string ConnStr= Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "LocalDB", "cardb.db");
	public string connectionstr { get; set; }
	public string dbFilePath {  get; set; }
	public SqliteDbContext(string connstr = "")
	{
		if (string.IsNullOrWhiteSpace(connstr))
		{
			
			connectionstr =SqliteDBHelper.GetCurrentDBPath();
		}
		else
		{
			connectionstr = connstr;
		}
		

	}
	protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
	{
		optionsBuilder.UseSqlite(this.connectionstr);
		base.OnConfiguring(optionsBuilder);
	}




}
